Добавил предпросмотр пациентов для поступления
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
<script setup>
|
||||
import {
|
||||
NModal, NDataTable, NEmpty, NSpin
|
||||
} from 'naive-ui'
|
||||
import { computed, ref, watch, h } from 'vue'
|
||||
import { MODAL_TYPES } from './config'
|
||||
import { getColumns } from './columns' // фабрика колонок
|
||||
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String,
|
||||
required: true,
|
||||
validator: (val) => Object.keys(MODAL_TYPES).includes(val),
|
||||
},
|
||||
startAt: { type: String, default: null },
|
||||
endAt: { type: String, default: null },
|
||||
// Дополнительные параметры фильтрации (например, отделение)
|
||||
departmentId: { type: Number, default: null },
|
||||
})
|
||||
|
||||
const open = defineModel('open')
|
||||
|
||||
const config = computed(() => MODAL_TYPES[props.type])
|
||||
const loading = ref(true)
|
||||
const patients = ref([])
|
||||
const filteredDepartments = ref([])
|
||||
|
||||
// Получаем уникальные отделения для фильтра
|
||||
const departmentOptions = computed(() => {
|
||||
const depts = new Set()
|
||||
patients.value.forEach(p => {
|
||||
if (p.department_name) depts.add(p.department_name)
|
||||
})
|
||||
return Array.from(depts).map(d => ({ label: d, value: d }))
|
||||
.sort((a, b) => a.label.localeCompare(b.label))
|
||||
})
|
||||
|
||||
// Фильтр по отделениям
|
||||
const filteredData = computed(() => {
|
||||
if (!filteredDepartments.value.length) return patients.value
|
||||
return patients.value.filter(p =>
|
||||
filteredDepartments.value.includes(p.department_name)
|
||||
)
|
||||
})
|
||||
|
||||
// Динамические колонки – получаем из фабрики
|
||||
const columns = computed(() => {
|
||||
const baseColumns = getColumns(props.type)
|
||||
// Добавляем фильтр по отделению в колонку 'department_name' если она существует
|
||||
return baseColumns.map(col => {
|
||||
if (col.key === 'department_name') {
|
||||
return {
|
||||
...col,
|
||||
filterMultiple: true,
|
||||
filterOptions: departmentOptions.value,
|
||||
filter: (value, row) => row.department_name?.includes(value) ?? false,
|
||||
}
|
||||
}
|
||||
return col
|
||||
})
|
||||
})
|
||||
|
||||
const fetchData = () => {
|
||||
loading.value = true
|
||||
const params = {
|
||||
startAt: props.startAt,
|
||||
endAt: props.endAt,
|
||||
departmentId: props.departmentId,
|
||||
type: props.type
|
||||
}
|
||||
axios.get('/api/statistics/reports/patients', { params })
|
||||
.then(res => {
|
||||
patients.value = res.data ?? []
|
||||
filteredDepartments.value = []
|
||||
})
|
||||
.finally(() => { loading.value = false })
|
||||
}
|
||||
|
||||
watch(open, (val) => {
|
||||
if (val) fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NModal
|
||||
v-model:show="open"
|
||||
:title="config?.title"
|
||||
preset="card"
|
||||
:mask-closable="false"
|
||||
:close-on-esc="false"
|
||||
class="max-w-5xl h-[calc(100vh-220px)]"
|
||||
>
|
||||
<template v-if="loading">
|
||||
<div class="flex items-center justify-center h-full"><NSpin /></div>
|
||||
</template>
|
||||
<template v-else-if="patients.length">
|
||||
<NDataTable
|
||||
:columns="columns"
|
||||
:data="filteredData"
|
||||
table-layout="fixed"
|
||||
size="small"
|
||||
max-height="calc(100vh - 350px)"
|
||||
:row-key="row => row.id"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="h-full flex items-center justify-center">
|
||||
<NEmpty description="Нет данных" />
|
||||
</div>
|
||||
</template>
|
||||
</NModal>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.n-data-table-th),
|
||||
:deep(.n-data-table-td) {
|
||||
font-size: var(--n-font-size);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,53 @@
|
||||
// columns/index.js
|
||||
import { h } from 'vue'
|
||||
import { formatDistanceStrict } from 'date-fns'
|
||||
import { ru } from 'date-fns/locale'
|
||||
import TooltipColumn from '../../../../Report/Components/DataTableColumns/TooltipColumn.vue'
|
||||
|
||||
export function getColumns(type) {
|
||||
// Базовые общие колонки
|
||||
const base = [
|
||||
{ title: '№', key: 'index', width: 30, render: (_, i) => i + 1 },
|
||||
{ title: 'ФИО', key: 'full_name', width: 200, ellipsis: { tooltip: { arrow: false } } },
|
||||
{ title: 'Возраст', key: 'age', width: 80, render: row => row.birth_date
|
||||
? formatDistanceStrict(new Date(row.birth_date), new Date(), { locale: ru })
|
||||
: '—' },
|
||||
{ title: 'Диагноз', key: 'diagnosis', width: 90, render: row =>
|
||||
row.diagnosis_code
|
||||
? h(TooltipColumn, { triggerText: row.diagnosis_code, contentText: row.diagnosis_name })
|
||||
: '—' },
|
||||
{ title: 'Отделение', key: 'department_name', width: 220 },
|
||||
]
|
||||
|
||||
// Дополнительные колонки для конкретных типов
|
||||
const extra = {
|
||||
RECIPIENT_ALL: [
|
||||
{ title: 'Дата поступления', key: 'admission_date', width: 130 },
|
||||
{ title: 'Тип', key: 'admission_type', width: 100 }, // планово/экстр
|
||||
],
|
||||
RECIPIENT_PLAN: [
|
||||
{ title: 'Дата поступления', key: 'admission_date', width: 130 },
|
||||
{ title: 'Тип', key: 'admission_type', width: 100 }, // планово/экстр
|
||||
],
|
||||
RECIPIENT_EMERGENCY: [
|
||||
{ title: 'Дата поступления', key: 'admission_date', width: 130 },
|
||||
{ title: 'Тип', key: 'admission_type', width: 100 }, // планово/экстр
|
||||
],
|
||||
SURGICAL_EMERGENCY: [
|
||||
{ title: 'Дата операции', key: 'operation_date', width: 130 },
|
||||
{ title: 'Хирург', key: 'surgeon', width: 150 },
|
||||
{ title: 'Операция', key: 'operation_name', width: 200 },
|
||||
],
|
||||
SURGICAL_PLAN: [
|
||||
{ title: 'Дата операции', key: 'operation_date', width: 130 },
|
||||
{ title: 'Хирург', key: 'surgeon', width: 150 },
|
||||
{ title: 'Операция', key: 'operation_name', width: 200 },
|
||||
],
|
||||
DECEASED: [
|
||||
{ title: 'Дата смерти', key: 'death_date', width: 120 },
|
||||
{ title: 'Причина смерти', key: 'cause_of_death', width: 150 },
|
||||
],
|
||||
}
|
||||
|
||||
return [...base, ...(extra[type] || [])]
|
||||
}
|
||||
72
resources/js/Pages/Statistic/Components/InfoModal/config.js
Normal file
72
resources/js/Pages/Statistic/Components/InfoModal/config.js
Normal file
@@ -0,0 +1,72 @@
|
||||
export const MODAL_TYPES = {
|
||||
RECIPIENT_ALL: {
|
||||
title: 'Поступившие',
|
||||
endpoint: '/api/statistics/reports/admitted-patients',
|
||||
columnsFactory: 'admittedColumns',
|
||||
},
|
||||
RECIPIENT_PLAN: {
|
||||
title: 'Плановые поступления',
|
||||
endpoint: '/api/statistics/reports/admitted-patients',
|
||||
columnsFactory: 'admittedColumns',
|
||||
},
|
||||
RECIPIENT_EMERGENCY: {
|
||||
title: 'Экстренные поступления',
|
||||
endpoint: '/api/statistics/reports/emergency-patients',
|
||||
columnsFactory: 'emergencyColumns',
|
||||
},
|
||||
RECIPIENT_TRANSFERRED: {
|
||||
title: 'Переведённые',
|
||||
endpoint: '/api/statistics/reports/transferred-patients',
|
||||
columnsFactory: 'transferredColumns',
|
||||
},
|
||||
OUTCOME: {
|
||||
title: 'Выбывшие',
|
||||
endpoint: '/api/statistics/reports/discharged-patients',
|
||||
columnsFactory: 'dischargedColumns',
|
||||
},
|
||||
CONSIST: {
|
||||
title: 'Состоит',
|
||||
endpoint: '/api/statistics/reports/admitted-patients',
|
||||
columnsFactory: 'admittedColumns',
|
||||
},
|
||||
AVERAGE_BED_DAYS: {
|
||||
title: 'Средний койко-день',
|
||||
endpoint: '/api/statistics/reports/admitted-patients',
|
||||
columnsFactory: 'admittedColumns',
|
||||
},
|
||||
PREOPERATIVE_DAYS: {
|
||||
title: 'Предоперационный койко-день',
|
||||
endpoint: '/api/statistics/reports/admitted-patients',
|
||||
columnsFactory: 'admittedColumns',
|
||||
},
|
||||
PERCENT_LOADED_BEDS: {
|
||||
title: 'Процент загруженности',
|
||||
endpoint: '/api/statistics/reports/admitted-patients',
|
||||
columnsFactory: 'admittedColumns',
|
||||
},
|
||||
LETHALITY: {
|
||||
title: 'Процент летальности',
|
||||
endpoint: '/api/statistics/reports/dead-patients',
|
||||
columnsFactory: 'deadColumns', // или функция
|
||||
},
|
||||
SURGICAL_EMERGENCY: {
|
||||
title: 'Экстренные операции',
|
||||
endpoint: '/api/statistics/reports/dead-patients',
|
||||
columnsFactory: 'deadColumns', // или функция
|
||||
},
|
||||
SURGICAL_PLAN: {
|
||||
title: 'Плановые операции',
|
||||
endpoint: '/api/statistics/reports/dead-patients',
|
||||
columnsFactory: 'deadColumns', // или функция
|
||||
},
|
||||
DECEASED: {
|
||||
title: 'Умершие',
|
||||
endpoint: '/api/statistics/reports/dead-patients',
|
||||
columnsFactory: 'deadColumns', // или функция
|
||||
},
|
||||
COUNT_STAFF: {
|
||||
title: 'Дежурный персонал',
|
||||
endpoint: '/api/statistics/reports/dead-patients',
|
||||
columnsFactory: 'deadColumns', // или функция
|
||||
},
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import {percentType} from "../../Utils/numbers.js";
|
||||
import OutcomeColumn from "./Components/OutcomeColumn.vue";
|
||||
import ModalDeathPatients from "./Components/ModalDeathPatients.vue";
|
||||
import DeceasedColumn from "./Components/DeceasedColumn.vue";
|
||||
import PatientListModal from "./Components/InfoModal/PatientListModal.vue";
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
@@ -150,6 +151,11 @@ const columns = ref([
|
||||
width: 60,
|
||||
titleAlign: 'center',
|
||||
align: 'center',
|
||||
cellProps: (row, i) => ({
|
||||
onClick: () => {
|
||||
onShowPatientsModal('RECIPIENT_ALL', row.department_id)
|
||||
}
|
||||
})
|
||||
},
|
||||
{
|
||||
title: 'План',
|
||||
@@ -157,6 +163,11 @@ const columns = ref([
|
||||
width: 60,
|
||||
titleAlign: 'center',
|
||||
align: 'center',
|
||||
cellProps: (row, i) => ({
|
||||
onClick: () => {
|
||||
onShowPatientsModal('RECIPIENT_PLAN', row.department_id)
|
||||
}
|
||||
})
|
||||
},
|
||||
{
|
||||
title: 'Экстр',
|
||||
@@ -164,6 +175,11 @@ const columns = ref([
|
||||
width: 60,
|
||||
titleAlign: 'center',
|
||||
align: 'center',
|
||||
cellProps: (row, i) => ({
|
||||
onClick: () => {
|
||||
onShowPatientsModal('RECIPIENT_EMERGENCY', row.department_id)
|
||||
}
|
||||
})
|
||||
},
|
||||
{
|
||||
title: 'Перевод',
|
||||
@@ -171,6 +187,11 @@ const columns = ref([
|
||||
width: 84,
|
||||
titleAlign: 'center',
|
||||
align: 'center',
|
||||
cellProps: (row, i) => ({
|
||||
onClick: () => {
|
||||
onShowPatientsModal('RECIPIENT_TRANSFERRED', row.department_id)
|
||||
}
|
||||
})
|
||||
},
|
||||
]
|
||||
},
|
||||
@@ -281,6 +302,14 @@ const currentDepartmentId = ref(null)
|
||||
const showUnwantedEventsModal = ref(false)
|
||||
const showObservablePatientsModal = ref(false)
|
||||
const showDeathPatientsModal = ref(false)
|
||||
const patientsModalType = ref(null)
|
||||
const showPatientsModalType = ref(false)
|
||||
|
||||
const onShowPatientsModal = (type, departmentId) => {
|
||||
patientsModalType.value = type
|
||||
currentDepartmentId.value = departmentId
|
||||
showPatientsModalType.value = true
|
||||
}
|
||||
|
||||
const onShowUnwantedEventsModal = (departmentId) => {
|
||||
currentDepartmentId.value = departmentId
|
||||
@@ -399,6 +428,9 @@ const buildReportHref = (departmentId, startAt, endAt) => {
|
||||
:start-at="date[0]" :end-at="date[1]" />
|
||||
<ModalDeathPatients v-model:open="showDeathPatientsModal"
|
||||
:start-at="date[0]" :end-at="date[1]" />
|
||||
|
||||
<PatientListModal :type="patientsModalType" v-model:open="showPatientsModalType" :department-id="currentDepartmentId"
|
||||
:start-at="date[0]" :end-at="date[1]" />
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -94,12 +94,35 @@ createInertiaApp({
|
||||
sendDefaultPii: true,
|
||||
integrations: [
|
||||
Sentry.replayIntegration(),
|
||||
// Sentry.feedbackIntegration({
|
||||
// colorScheme: "system",
|
||||
// showBranding: false,
|
||||
// triggerLabel: "Сообщить об ошибке",
|
||||
// triggerAriaLabel: "Открыть форму обратной связи",
|
||||
// formTitle: "Сообщить об ошибке",
|
||||
// submitButtonLabel: "Отправить отчёт",
|
||||
// cancelButtonLabel: "Отмена",
|
||||
// confirmButtonLabel: "Подтвердить",
|
||||
// addScreenshotButtonLabel: "Добавить скриншот",
|
||||
// removeScreenshotButtonLabel: "Удалить скриншот",
|
||||
// nameLabel: "Имя",
|
||||
// namePlaceholder: "Ваше имя",
|
||||
// emailLabel: "Email",
|
||||
// emailPlaceholder: "ваш.email@пример.рф",
|
||||
// isRequiredLabel: "(обязательно)",
|
||||
// messageLabel: "Описание проблемы",
|
||||
// messagePlaceholder: "В чём ошибка? Что вы ожидали?",
|
||||
// successMessageText: "Спасибо за ваш отчёт!",
|
||||
// highlightToolText: "Выделить",
|
||||
// hideToolText: "Скрыть",
|
||||
// removeHighlightText: "Убрать",
|
||||
// }),
|
||||
],
|
||||
// Session Replay
|
||||
replaysSessionSampleRate: 0, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
|
||||
replaysOnErrorSampleRate: 0.5, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.,
|
||||
// Logs
|
||||
enableLogs: true
|
||||
enableLogs: true,
|
||||
});
|
||||
|
||||
vueApp.mount(el)
|
||||
|
||||
Reference in New Issue
Block a user