Compare commits

...

2 Commits

Author SHA1 Message Date
brusnitsyn
bb36ef3a40 Merge remote-tracking branch 'origin/main'
Some checks failed
Build and Push Docker Image / test (push) Has been cancelled
Build and Push Docker Image / build (push) Has been cancelled
2025-12-29 17:08:46 +09:00
brusnitsyn
56be95caa4 Обновление 1.0 2025-12-29 17:08:26 +09:00
9 changed files with 191 additions and 66 deletions

View File

@@ -22,7 +22,19 @@ class MedicalHistoryController extends Controller
if ($viewType == 'foxpro') $patient = SiSttMedicalHistory::where('keykarta', $id)->first(); if ($viewType == 'foxpro') $patient = SiSttMedicalHistory::where('keykarta', $id)->first();
else $patient = MisSttMedicalHistory::where('MedicalHistoryID', $id)->first(); else $patient = MisSttMedicalHistory::where('MedicalHistoryID', $id)->first();
$archiveJournal = $patient->archiveHistory ? ArchiveHistoryResource::collection($patient->archiveHistory) : null; if($patient instanceof MisSttMedicalHistory) {
if ($patient->archiveHistory->count() === 0) {
$foxproCardId = $patient->archiveInfo->foxpro_history_id;
$foxproPatient = SiSttMedicalHistory::where('keykarta', $foxproCardId)->first();
$journalHistory = $foxproPatient->archiveHistory;
} else {
$journalHistory = $patient->archiveHistory;
}
} else {
$journalHistory = $patient->archiveHistory;
}
$archiveInfo = $patient->archiveInfo ? $patient->archiveInfo : null; $archiveInfo = $patient->archiveInfo ? $patient->archiveInfo : null;
$patientInfo = [ $patientInfo = [
@@ -32,7 +44,7 @@ class MedicalHistoryController extends Controller
...PatientInfoResource::make($patient)->toArray(request()), ...PatientInfoResource::make($patient)->toArray(request()),
'can_be_issued' => $patient->canBeIssued() 'can_be_issued' => $patient->canBeIssued()
], ],
'journal' => $archiveJournal, 'journal' => ArchiveHistoryResource::collection($journalHistory),
'archiveInfo' => $archiveInfo ? ArchiveInfoResource::make($archiveInfo) : null 'archiveInfo' => $archiveInfo ? ArchiveInfoResource::make($archiveInfo) : null
]; ];

View File

@@ -1,7 +1,8 @@
services: services:
#PHP Service #PHP Service
app: app:
image: kartoteka:v1.0 image: registry.brusoff.su/kartoteka:1.0
build: .
container_name: kartoteka_app container_name: kartoteka_app
restart: unless-stopped restart: unless-stopped
ports: ports:

View File

@@ -106,8 +106,8 @@ server {
# ========== API ENDPOINTS ========== # ========== API ENDPOINTS ==========
location ~* ^/api/ { location ~* ^/api/ {
limit_req zone=api_limit burst=15 delay=8; limit_req zone=api_limit burst=30 delay=15;
limit_conn conn_limit_per_ip 15; limit_conn conn_limit_per_ip 30;
access_log /var/log/nginx/api_access.log main; access_log /var/log/nginx/api_access.log main;
@@ -129,8 +129,8 @@ server {
location ~ \.php$ { location ~ \.php$ {
# Дефолтные лимиты для всех PHP запросов # Дефолтные лимиты для всех PHP запросов
limit_req zone=req_limit_per_ip burst=20 delay=10; limit_req zone=req_limit_per_ip burst=30 delay=15;
limit_conn conn_limit_per_ip 20; limit_conn conn_limit_per_ip 30;
try_files $uri =404; try_files $uri =404;
@@ -145,9 +145,9 @@ server {
fastcgi_temp_file_write_size 256k; fastcgi_temp_file_write_size 256k;
# Таймауты # Таймауты
fastcgi_connect_timeout 10s; fastcgi_connect_timeout 60s;
fastcgi_send_timeout 30s; fastcgi_send_timeout 600s;
fastcgi_read_timeout 30s; fastcgi_read_timeout 600s;
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
@@ -157,12 +157,8 @@ server {
# ========== ОСНОВНОЙ LOCATION ========== # ========== ОСНОВНОЙ LOCATION ==========
location / { location / {
# Блокировка сканирования
if ($request_uri ~* "(%0|%A|%0A|%0D|%0a|%0d)") {
return 444;
}
if ($query_string ~* "(union|select|insert|update|delete|drop|create|alter|exec)") { if ($query_string ~* "(?:^|[^a-z])(?:union|select|insert|update|delete|drop|create|alter|exec)(?:[^a-z]|$)") {
return 444; return 444;
} }

View File

@@ -40,7 +40,7 @@ http {
sendfile on; sendfile on;
tcp_nopush on; tcp_nopush on;
tcp_nodelay on; tcp_nodelay on;
keepalive_timeout 65; keepalive_timeout 75;
keepalive_requests 100; keepalive_requests 100;
types_hash_max_size 2048; types_hash_max_size 2048;
server_tokens off; server_tokens off;
@@ -49,7 +49,7 @@ http {
client_body_timeout 12; client_body_timeout 12;
client_header_timeout 12; client_header_timeout 12;
send_timeout 10; send_timeout 30;
reset_timedout_connection on; reset_timedout_connection on;
client_header_buffer_size 1k; client_header_buffer_size 1k;

View File

@@ -124,6 +124,11 @@ export const useMedicalHistoryFilter = (initialFilters = {}) => {
const searchValue = ref(filtersRef.value.search ?? null) const searchValue = ref(filtersRef.value.search ?? null)
const statusValue = computed(() => {
if (filtersRef.value.status !== null) return Number(filtersRef.value.status)
else return filtersRef.value.status
})
const handleDateRangeChange = (timestamps) => { const handleDateRangeChange = (timestamps) => {
dateRange.value = timestamps || [null, null] dateRange.value = timestamps || [null, null]
@@ -238,9 +243,6 @@ export const useMedicalHistoryFilter = (initialFilters = {}) => {
updates.date_extract_to = null updates.date_extract_to = null
dateRange.value = [null, null] dateRange.value = [null, null]
break break
case 'database':
updates.database = 'postgresql'
break
} }
Object.assign(filtersRef.value, updates) Object.assign(filtersRef.value, updates)
@@ -277,6 +279,7 @@ export const useMedicalHistoryFilter = (initialFilters = {}) => {
activeFilters, activeFilters,
dateRange, dateRange,
searchValue, searchValue,
statusValue,
// Обработчики // Обработчики
handleSearch, handleSearch,

View File

@@ -14,13 +14,15 @@ export function useNotification() {
} }
const errorApi = (data, content = '', options = {}) => { const errorApi = (data, content = null, options = {}) => {
return showNotification( return showNotification(
{ {
title: 'Произошла ошибка', title: 'Произошла ошибка',
description: `Код: ${data.code}\nURL: ${data.response.config.url}\nМетод: ${data.response.config.method.toUpperCase()}`, description: data
? `Код: ${data.code}\nURL: ${data.response.config.url}\nМетод: ${data.response.config.method.toUpperCase()}`
: null,
content: () => { content: () => {
return h( return content ? content : h(
NLog, NLog,
{ {
rows: 4, rows: 4,

View File

@@ -15,7 +15,40 @@ const archiveInfo = ref({
num: null, num: null,
post_in: null, post_in: null,
}) })
const archiveInfoRules = {
id: [
{
required: true,
validator(rule, value) {
console.log(value)
if (!value) {
return new Error('Это поле необходимо заполнить')
}
else if (!Number(value)) {
return new Error('Ошибка при получении ID')
}
return true
},
trigger: ['input', 'blur']
}
],
num: [
{
required: true,
message: 'Это поле необходимо заполнить',
trigger: 'blur'
}
],
post_in: [
{
required: true,
message: 'Это поле необходимо заполнить',
trigger: 'blur'
}
]
}
const loadingFilterPatients = ref(false) const loadingFilterPatients = ref(false)
const formRef = ref(null)
const emits = defineEmits(['historyUpdated', 'closeWithoutSave']) const emits = defineEmits(['historyUpdated', 'closeWithoutSave'])
@@ -30,6 +63,7 @@ const onResetData = () => {
const onCloseWithoutSave = () => { const onCloseWithoutSave = () => {
emits('closeWithoutSave') emits('closeWithoutSave')
open.value = false open.value = false
onResetData()
} }
const filteredPatients = ref([]) const filteredPatients = ref([])
@@ -49,51 +83,79 @@ const handleSearchCard = (query) => {
debounceSearchCard(query) debounceSearchCard(query)
} }
const onSubmit = async () => { const onSubmit = async (e) => {
loading.value = true e.preventDefault()
try { formRef.value?.validate(async (errors) => {
await axios.post(`/api/archive/create`, archiveInfo.value).then(res => { if (!errors) {
open.value = false loading.value = true
}) try {
await axios.post(`/api/archive/create`, archiveInfo.value).then(res => {
open.value = false
})
} catch (error) { } catch (error) {
errorApi(error) errorApi(error)
console.error(error) console.error(error)
} finally { } finally {
loading.value = false loading.value = false
} }
}
else {
console.log(errors)
errorApi(null, 'Проверьте заполненность формы')
}
})
} }
</script> </script>
<template> <template>
<NModal v-model:show="open" preset="card" class="max-w-xl relative overflow-clip" closable @close="onCloseWithoutSave"> <NModal v-model:show="open"
<template #header> preset="card"
Добавить карту в архив class="max-w-xl relative"
</template> :mask-closable="false"
closable
title="Добавить карту в архив"
@close="onCloseWithoutSave">
<NFlex class="w-full" :wrap="false"> <NFlex class="w-full" :wrap="false">
<NForm class="w-full"> <NForm ref="formRef" id="formAddToArchive" class="w-full" :model="archiveInfo" :rules="archiveInfoRules">
<NFormItem label="Пациент"> <NFormItem label="Карта пациента" path="id">
<NSelect placeholder="№ карты фамилия имя отчество или фамилия имя отчество" size="large" :remote filterable :loading="loadingFilterPatients" :options="filteredPatients" v-model:value="archiveInfo.id" @search="handleSearchCard" /> <NSelect placeholder="№ карты фамилия имя отчество ИЛИ фамилия имя отчество"
size="large"
:remote
filterable
:loading="loadingFilterPatients"
:options="filteredPatients"
v-model:value="archiveInfo.id"
@search="handleSearchCard"
/>
</NFormItem> </NFormItem>
<NFormItem size="large" label="№ в архиве"> <NFormItem size="large" label="Дата поступления карты в архив" path="post_in">
<NDatePicker class="w-full"
v-model:value="archiveInfo.post_in"
format="dd.MM.yyyy"
/>
</NFormItem>
<NFormItem size="large" label="№ в архиве" path="num">
<NInput v-model:value="archiveInfo.num" /> <NInput v-model:value="archiveInfo.num" />
</NFormItem> </NFormItem>
<NFormItem size="large" label="Дата поступления карты в архив">
<NDatePicker class="w-full" v-model:value="archiveInfo.post_in" format="dd.MM.yyyy" />
</NFormItem>
</NForm> </NForm>
</NFlex> </NFlex>
<template #action> <template #action>
<NFlex justify="end" align="center"> <NFlex justify="end" align="center">
<NSpace align="center" :size="0"> <NSpace align="center" :size="0">
<NButton secondary type="primary" @click="onSubmit"> <NButton secondary
type="primary"
attr-type="submit"
form="formAddToArchive"
@click="onSubmit">
Добавить карту Добавить карту
</NButton> </NButton>
</NSpace> </NSpace>
</NFlex> </NFlex>
</template> </template>
<div v-show="loading" class="absolute inset-0 z-10 backdrop-blur flex items-center justify-center"> <div v-show="loading"
class="absolute inset-0 z-10 backdrop-blur flex items-center justify-center rounded-[8px]">
<NSpin :show="true" /> <NSpin :show="true" />
</div> </div>
</NModal> </NModal>

View File

@@ -29,13 +29,12 @@ const dataTable = ref(props.data ?? [])
const archiveStatusColumn = (status) => { const archiveStatusColumn = (status) => {
const tagType = status?.variant ?? 'error' const tagType = status?.variant ?? 'error'
const tagText = status?.text ?? 'Нет в архиве' const tagText = status?.text ?? 'Нет в архиве'
console.log(tagType)
return h( return h(
NEllipsis, NEllipsis,
null, null,
{ {
default: () => h(NTag, {type: tagType, round: true, size: 'small'}, tagText) default: () => h(NTag, {type: tagType, bordered: false, round: true, size: 'small'}, tagText)
}) })
} }
@@ -136,8 +135,22 @@ watch(() => props.data, (newData) => {
</script> </script>
<template> <template>
<NDataTable remote striped :loading="isLoading" :row-props="rowProps" :columns="columns" :pagination="pagination" :max-height="maxHeight" size="small" :min-height="minHeight" :data="dataTable" /> <NDataTable remote
<ArchiveHistoryModal v-model:open="showArchiveHistoryModal" :patient-info="selectedPatientInfo" @history-updated="onUpdateHistory" @close-without-save="onCloseWithoutSave" /> striped
:loading="isLoading"
:row-props="rowProps"
:columns="columns"
:pagination="pagination"
:max-height="maxHeight"
size="small"
:min-height="minHeight"
:data="dataTable"
/>
<ArchiveHistoryModal v-model:open="showArchiveHistoryModal"
:patient-info="selectedPatientInfo"
@history-updated="onUpdateHistory"
@close-without-save="onCloseWithoutSave"
/>
</template> </template>
<style scoped> <style scoped>

View File

@@ -24,10 +24,15 @@ const props = defineProps({
const ArchiveHistoryCreateModalShow = ref(false) const ArchiveHistoryCreateModalShow = ref(false)
const { const {
isLoading, applyFilters, filtersRef, handleSearch, dateRange, searchValue, isLoading, applyFilters, filtersRef, handleSearch, dateRange, searchValue,
handleDateRangeChange, handleViewTypeChange, handleStatusChange statusValue, handleDateRangeChange, handleViewTypeChange, handleStatusChange
} = useMedicalHistoryFilter(props.filters) } = useMedicalHistoryFilter(props.filters)
const viewType = ref('archive') const viewType = ref('archive')
const searchRef = ref()
const onHandleSearch = (search) => {
handleSearch(search)
}
const handleBeforeLeave = (tabName) => { const handleBeforeLeave = (tabName) => {
handleViewTypeChange(tabName) handleViewTypeChange(tabName)
@@ -39,36 +44,67 @@ const handleBeforeLeave = (tabName) => {
<AppLayout> <AppLayout>
<template #header> <template #header>
<NSpace vertical> <NSpace vertical>
<!-- <NH1 class="!my-0 mb-5">-->
<!-- Архив-->
<!-- </NH1>-->
<!-- <NRadioGroup v-model:value="viewType" @update:value="val => handleViewTypeChange(val)">-->
<!-- <NRadioButton value="archive">Архив</NRadioButton>-->
<!-- <NRadioButton value="mis">МИС</NRadioButton>-->
<!-- <NRadioButton value="softinfo">СофтИнфо</NRadioButton>-->
<!-- </NRadioGroup>-->
<NFlex class="pb-4" align="center" :wrap="false"> <NFlex class="pb-4" align="center" :wrap="false">
<NFormItem class="w-[720px]" label="Поиск" :show-feedback="false"> <NFormItem class="w-[720px]" label="Поиск" :show-feedback="false">
<NInput placeholder="Поиск по ФИО, № карты" v-model:value="searchValue" @update:value="val => handleSearch(val)" size="large" /> <NInput placeholder="Поиск по ФИО, № карты"
autofocus
ref="searchRef"
clearable
v-model:value="searchValue"
@update:value="val => onHandleSearch(val)"
size="large"
:loading="isLoading"
:disabled="isLoading"
/>
</NFormItem> </NFormItem>
<div class="mt-6"> <div class="mt-6">
<NDivider vertical /> <NDivider vertical />
</div> </div>
<NFormItem class="w-[340px]" label="Дата выписки" :show-feedback="false"> <NFormItem class="w-[340px]" label="Дата выписки" :show-feedback="false">
<NDatePicker v-model:value="dateRange" @update:value="handleDateRangeChange" type="daterange" clearable format="dd.MM.yyyy" start-placeholder="Дата выписки с" end-placeholder="по" size="large" /> <NDatePicker v-model:value="dateRange"
@update:value="handleDateRangeChange"
type="daterange"
clearable
format="dd.MM.yyyy"
start-placeholder="Дата выписки с"
end-placeholder="по"
size="large"
:disabled="isLoading"
/>
</NFormItem> </NFormItem>
<NFormItem class="w-[340px]" label="Статус карты" :show-feedback="false"> <NFormItem class="w-[340px]" label="Статус карты" :show-feedback="false">
<NSelect :options="statuses" @update:value="val => handleStatusChange(val)" clearable size="large" /> <NSelect :options="statuses"
:value="statusValue"
@update:value="val => handleStatusChange(val)"
clearable
size="large"
:loading="isLoading"
:disabled="isLoading"
/>
</NFormItem> </NFormItem>
<div class="mt-6">
<NDivider vertical />
</div>
<NFormItem class="w-[340px]" :show-feedback="false"> <NFormItem class="w-[340px]" :show-feedback="false">
<NButton type="primary" @click="ArchiveHistoryCreateModalShow = true" secondary size="large"> <NButton type="primary"
@click="ArchiveHistoryCreateModalShow = true"
secondary
size="large"
:loading="isLoading"
:disabled="isLoading"
>
Добавить карту в архив Добавить карту в архив
</NButton> </NButton>
</NFormItem> </NFormItem>
</NFlex> </NFlex>
</NSpace> </NSpace>
</template> </template>
<TableCards :filters="filters" :data="cards.data" :meta="cards.meta" min-height="calc(100vh - 212px)" max-height="calc(100vh - 320px)" /> <TableCards :filters="filters"
:data="cards.data"
:meta="cards.meta"
min-height="calc(100vh - 212px)"
max-height="calc(100vh - 320px)"
/>
<ArchiveHistoryCreateModal v-model:open="ArchiveHistoryCreateModalShow" /> <ArchiveHistoryCreateModal v-model:open="ArchiveHistoryCreateModalShow" />
</AppLayout> </AppLayout>
</template> </template>