Обновление отчета
This commit is contained in:
@@ -136,9 +136,20 @@ class ReportController extends Controller
|
|||||||
->map(function ($item, $index) {
|
->map(function ($item, $index) {
|
||||||
$item->num = $index + 1;
|
$item->num = $index + 1;
|
||||||
return $item;
|
return $item;
|
||||||
});;
|
});
|
||||||
|
} else if ($status === 'observation') {
|
||||||
|
$patients = ObservationPatient::with(['history'])
|
||||||
|
->where('rf_department_id', $misDepartmentId)
|
||||||
|
->history;
|
||||||
} else if ($status === 'deceased') {
|
} else if ($status === 'deceased') {
|
||||||
|
$patients = MisMedicalHistory::select(...$model->getFillable())
|
||||||
|
->deceased()
|
||||||
|
->inDepartment($misDepartmentId, $startDate, $endDate)
|
||||||
|
->get()
|
||||||
|
->map(function ($item, $index) {
|
||||||
|
$item->num = $index + 1;
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$patients->load(['migrations' => function ($query) use ($startDate, $endDate, $misStationarBranchId) {
|
$patients->load(['migrations' => function ($query) use ($startDate, $endDate, $misStationarBranchId) {
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ class StatisticController extends Controller
|
|||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
$departments = Department::select('department_id', 'name_short')->get();
|
$departments = Department::select('department_id', 'name_short')
|
||||||
|
->orderBy('name_short')->get();
|
||||||
|
|
||||||
foreach ($departments as $department) {
|
foreach ($departments as $department) {
|
||||||
$allCount = MetrikaResult::whereHas('report', function ($query) use ($userDepartment, $department) {
|
$allCount = MetrikaResult::whereHas('report', function ($query) use ($userDepartment, $department) {
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ class FormattedPatientResource extends JsonResource
|
|||||||
'num' => $this->num,
|
'num' => $this->num,
|
||||||
'mkb' => $this->whenLoaded('migrations', function () {
|
'mkb' => $this->whenLoaded('migrations', function () {
|
||||||
return [
|
return [
|
||||||
'ds' => $this->migrations()->first()->diagnosis()->first()->mkb()->first()->DS ?? null,
|
'ds' => $this->migrations()->first()->diagnosis()->first()?->mkb()->first()->DS ?? null,
|
||||||
'name' => $this->migrations()->first()->diagnosis()->first()->mkb()->first()->NAME ?? null,
|
'name' => $this->migrations()->first()->diagnosis()->first()?->mkb()->first()->NAME ?? null,
|
||||||
];
|
];
|
||||||
}),
|
}),
|
||||||
'fullname' => Str::ucwords(Str::lower("$this->FAMILY $this->Name $this->OT")),
|
'fullname' => Str::ucwords(Str::lower("$this->FAMILY $this->Name $this->OT")),
|
||||||
|
|||||||
@@ -40,6 +40,14 @@ class MisMedicalHistory extends Model
|
|||||||
return $this->where('rf_EmerSignID', 2);
|
return $this->where('rf_EmerSignID', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Истории с результатом - Умер
|
||||||
|
*/
|
||||||
|
public function scopeDeceased()
|
||||||
|
{
|
||||||
|
return $this->where('rf_kl_VisitResultID', 5);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Движения истории
|
* Движения истории
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,4 +15,9 @@ class ObservationPatient extends Model
|
|||||||
'rf_department_id',
|
'rf_department_id',
|
||||||
'rf_report_id',
|
'rf_report_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function history()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(MisMedicalHistory::class, 'rf_medicalhistory_id', 'MedicalHistoryID');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class TestDepartmentDataSeeder extends Seeder
|
|||||||
DepartmentMetrikaDefault::create([
|
DepartmentMetrikaDefault::create([
|
||||||
'rf_department_id' => 2,
|
'rf_department_id' => 2,
|
||||||
'rf_metrika_item_id' => 1,
|
'rf_metrika_item_id' => 1,
|
||||||
'value' => '45'
|
'value' => '42'
|
||||||
]);
|
]);
|
||||||
DepartmentMetrikaDefault::create([
|
DepartmentMetrikaDefault::create([
|
||||||
'rf_department_id' => 3,
|
'rf_department_id' => 3,
|
||||||
@@ -135,17 +135,17 @@ class TestDepartmentDataSeeder extends Seeder
|
|||||||
DepartmentMetrikaDefault::create([
|
DepartmentMetrikaDefault::create([
|
||||||
'rf_department_id' => 8,
|
'rf_department_id' => 8,
|
||||||
'rf_metrika_item_id' => 1,
|
'rf_metrika_item_id' => 1,
|
||||||
'value' => '50'
|
'value' => '48'
|
||||||
]);
|
]);
|
||||||
DepartmentMetrikaDefault::create([
|
DepartmentMetrikaDefault::create([
|
||||||
'rf_department_id' => 9,
|
'rf_department_id' => 9,
|
||||||
'rf_metrika_item_id' => 1,
|
'rf_metrika_item_id' => 1,
|
||||||
'value' => '50'
|
'value' => '27'
|
||||||
]);
|
]);
|
||||||
DepartmentMetrikaDefault::create([
|
DepartmentMetrikaDefault::create([
|
||||||
'rf_department_id' => 10,
|
'rf_department_id' => 10,
|
||||||
'rf_metrika_item_id' => 1,
|
'rf_metrika_item_id' => 1,
|
||||||
'value' => '55'
|
'value' => '58'
|
||||||
]);
|
]);
|
||||||
DepartmentMetrikaDefault::create([
|
DepartmentMetrikaDefault::create([
|
||||||
'rf_department_id' => 11,
|
'rf_department_id' => 11,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const currentDate = computed(() => {
|
|||||||
:icon="TbArticle"
|
:icon="TbArticle"
|
||||||
/>
|
/>
|
||||||
<StartButton title="Статистика моего отделения"
|
<StartButton title="Статистика моего отделения"
|
||||||
:description="`Ваше отделение в системе: ${authStore.user.current_department.departmentname}`"
|
:description="`Ваше отделение в системе: ${authStore.userDepartment.name_short}`"
|
||||||
:href="`/statistic?sent_at=${reportStore.timestampCurrentRange}&groupId=1`"
|
:href="`/statistic?sent_at=${reportStore.timestampCurrentRange}&groupId=1`"
|
||||||
:icon="TbChartTreemap"
|
:icon="TbChartTreemap"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {NCard, NFlex, NFormItem, NForm, NInputNumber} from "naive-ui";
|
import {NCard, NSkeleton, NFlex, NFormItem, NForm, NInputNumber} from "naive-ui";
|
||||||
import {useReportStore} from "../../../Stores/report.js";
|
import {useReportStore} from "../../../Stores/report.js";
|
||||||
|
|
||||||
const reportStore = useReportStore()
|
const reportStore = useReportStore()
|
||||||
@@ -9,6 +9,11 @@ const reportStore = useReportStore()
|
|||||||
<NCard>
|
<NCard>
|
||||||
<NForm>
|
<NForm>
|
||||||
<NFlex>
|
<NFlex>
|
||||||
|
<template v-if="reportStore.isLoadReportInfo">
|
||||||
|
<NSkeleton class="w-[246px]! h-[60px]!" />
|
||||||
|
<NSkeleton class="w-[246px]! h-[60px]!" />
|
||||||
|
<NSkeleton class="w-[246px]! h-[60px]!" />
|
||||||
|
</template>
|
||||||
<template v-for="metrikaItem in reportStore.reportInfo?.metrikaItems">
|
<template v-for="metrikaItem in reportStore.reportInfo?.metrikaItems">
|
||||||
<NFormItem :label="metrikaItem.name" :show-feedback="false">
|
<NFormItem :label="metrikaItem.name" :show-feedback="false">
|
||||||
<NInputNumber v-model:value="reportStore.reportForm[`metrika_item_${metrikaItem.metrika_item_id}`]"
|
<NInputNumber v-model:value="reportStore.reportForm[`metrika_item_${metrikaItem.metrika_item_id}`]"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {NStatistic, NRow, NCol, NCard, NButton, NTag, NDatePicker, NFlex, NSelect, NText, NH2} from "naive-ui";
|
import {NSkeleton, NStatistic, NRow, NCol, NCard, NButton, NTag, NDatePicker, NFlex, NSelect, NText, NH2} from "naive-ui";
|
||||||
import {computed, ref} from "vue";
|
import {computed, ref} from "vue";
|
||||||
import {format} from "date-fns";
|
import {format} from "date-fns";
|
||||||
import {useNow} from "@vueuse/core";
|
import {useNow} from "@vueuse/core";
|
||||||
@@ -65,10 +65,20 @@ const currentDate = computed(() => {
|
|||||||
<NFlex justify="space-between" align="center" :wrap="false">
|
<NFlex justify="space-between" align="center" :wrap="false">
|
||||||
<NRow class="grow">
|
<NRow class="grow">
|
||||||
<NCol :span="4">
|
<NCol :span="4">
|
||||||
<NStatistic label="Коек" :value="reportStore.reportInfo?.department.beds" />
|
<NStatistic label="Коек">
|
||||||
|
<template #default>
|
||||||
|
<NSkeleton v-if="reportStore.isLoadReportInfo" round class="w-[70px]! mt-2 h-[29px]!" />
|
||||||
|
<span v-else>{{ reportStore.reportInfo?.department.beds }}</span>
|
||||||
|
</template>
|
||||||
|
</NStatistic>
|
||||||
</NCol>
|
</NCol>
|
||||||
<NCol :span="5">
|
<NCol :span="5">
|
||||||
<NStatistic label="Загруженность" :value="`${reportStore.reportInfo?.department.percentLoadedBeds}%`" />
|
<NStatistic label="Загруженность">
|
||||||
|
<template #default>
|
||||||
|
<NSkeleton v-if="reportStore.isLoadReportInfo" round class="w-[70px]! mt-2 h-[29px]!" />
|
||||||
|
<span v-else>{{ reportStore.reportInfo?.department.percentLoadedBeds }}%</span>
|
||||||
|
</template>
|
||||||
|
</NStatistic>
|
||||||
</NCol>
|
</NCol>
|
||||||
</NRow>
|
</NRow>
|
||||||
|
|
||||||
|
|||||||
@@ -107,18 +107,14 @@ const handleDrop = (e) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fetchPatients = async () => {
|
const fetchPatients = async () => {
|
||||||
if (props.status === 'plan' || props.status === 'emergency') {
|
isLoading.value = true
|
||||||
isLoading.value = true
|
await axios.post('/api/mis/patients', {
|
||||||
await axios.post('/api/mis/patients', {
|
status: props.status
|
||||||
status: props.status
|
}).then((res) => {
|
||||||
}).then((res) => {
|
patientsData.value[props.status] = res.data
|
||||||
patientsData.value[props.status] = res.data
|
}).finally(() => {
|
||||||
}).finally(() => {
|
|
||||||
isLoading.value = false
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function rowProps(row) {
|
function rowProps(row) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const columns = ref([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Состояло',
|
title: 'Состояло',
|
||||||
key: 'beds',
|
key: '',
|
||||||
width: 84,
|
width: 84,
|
||||||
titleAlign: 'center',
|
titleAlign: 'center',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
@@ -112,24 +112,23 @@ const columns = ref([
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AppLayout>
|
<AppLayout>
|
||||||
<NDataTable :columns="columns"
|
<NDataTable :columns="columns"
|
||||||
:data="data"
|
:data="data"
|
||||||
size="small"
|
size="small"
|
||||||
:single-line="false"
|
:single-line="false"
|
||||||
striped
|
striped
|
||||||
min-height="calc(100vh - 48px - 70px)"
|
min-height="calc(100vh - 48px - 70px)"
|
||||||
max-height="calc(100vh - 48px - 70px)"
|
max-height="calc(100vh - 48px - 70px)"
|
||||||
>
|
>
|
||||||
|
|
||||||
</NDataTable>
|
</NDataTable>
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
:deep(.n-data-table-th),
|
:deep(.n-data-table-th),
|
||||||
:deep(.n-data-table-td) {
|
:deep(.n-data-table-td) {
|
||||||
//white-space: nowrap !important;
|
|
||||||
font-size: var(--n-font-size);
|
font-size: var(--n-font-size);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export const useReportStore = defineStore('reportStore', () => {
|
|||||||
const dataOnReport = ref(null)
|
const dataOnReport = ref(null)
|
||||||
|
|
||||||
const reportInfo = ref(null)
|
const reportInfo = ref(null)
|
||||||
|
const isLoadReportInfo = ref(false)
|
||||||
|
|
||||||
const patientColumns = [
|
const patientColumns = [
|
||||||
{
|
{
|
||||||
@@ -94,9 +95,14 @@ export const useReportStore = defineStore('reportStore', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getReportInfo = async () => {
|
const getReportInfo = async () => {
|
||||||
await axios.get('/api/report').then((res) => {
|
isLoadReportInfo.value = true
|
||||||
reportInfo.value = res.data
|
await axios.get('/api/report')
|
||||||
})
|
.then((res) => {
|
||||||
|
reportInfo.value = res.data
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
isLoadReportInfo.value = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDataOnReportDate = async () => {
|
const getDataOnReportDate = async () => {
|
||||||
@@ -114,6 +120,7 @@ export const useReportStore = defineStore('reportStore', () => {
|
|||||||
timestampNow,
|
timestampNow,
|
||||||
timestampCurrent,
|
timestampCurrent,
|
||||||
timestampCurrentRange,
|
timestampCurrentRange,
|
||||||
|
isLoadReportInfo,
|
||||||
dataOnReport,
|
dataOnReport,
|
||||||
patientColumns,
|
patientColumns,
|
||||||
patientsData,
|
patientsData,
|
||||||
|
|||||||
Reference in New Issue
Block a user