From 56be95caa4f3b1d00e5edd979355fcaf03ccb5f4 Mon Sep 17 00:00:00 2001 From: brusnitsyn Date: Mon, 29 Dec 2025 17:08:26 +0900 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=201.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/MedicalHistoryController.php | 16 ++- docker-compose.yml | 3 +- docker/app.conf | 20 ++-- docker/nginx.conf | 4 +- .../js/Composables/useMedicalHistoryFilter.js | 9 +- resources/js/Composables/useNotification.js | 8 +- .../Home/ArchiveHistoryCreateModal/Index.vue | 112 ++++++++++++++---- resources/js/Pages/Home/DataTable/Index.vue | 21 +++- resources/js/Pages/Home/Index.vue | 64 +++++++--- 9 files changed, 191 insertions(+), 66 deletions(-) diff --git a/app/Http/Controllers/MedicalHistoryController.php b/app/Http/Controllers/MedicalHistoryController.php index be5b21d..0ccfb09 100644 --- a/app/Http/Controllers/MedicalHistoryController.php +++ b/app/Http/Controllers/MedicalHistoryController.php @@ -22,7 +22,19 @@ class MedicalHistoryController extends Controller if ($viewType == 'foxpro') $patient = SiSttMedicalHistory::where('keykarta', $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; $patientInfo = [ @@ -32,7 +44,7 @@ class MedicalHistoryController extends Controller ...PatientInfoResource::make($patient)->toArray(request()), 'can_be_issued' => $patient->canBeIssued() ], - 'journal' => $archiveJournal, + 'journal' => ArchiveHistoryResource::collection($journalHistory), 'archiveInfo' => $archiveInfo ? ArchiveInfoResource::make($archiveInfo) : null ]; diff --git a/docker-compose.yml b/docker-compose.yml index adcc801..e0325a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,8 @@ services: #PHP Service app: - image: kartoteka:v1.0 + image: registry.brusoff.su/kartoteka:1.0 + build: . container_name: kartoteka_app restart: unless-stopped ports: diff --git a/docker/app.conf b/docker/app.conf index e448d1b..cf60464 100644 --- a/docker/app.conf +++ b/docker/app.conf @@ -106,8 +106,8 @@ server { # ========== API ENDPOINTS ========== location ~* ^/api/ { - limit_req zone=api_limit burst=15 delay=8; - limit_conn conn_limit_per_ip 15; + limit_req zone=api_limit burst=30 delay=15; + limit_conn conn_limit_per_ip 30; access_log /var/log/nginx/api_access.log main; @@ -129,8 +129,8 @@ server { location ~ \.php$ { # Дефолтные лимиты для всех PHP запросов - limit_req zone=req_limit_per_ip burst=20 delay=10; - limit_conn conn_limit_per_ip 20; + limit_req zone=req_limit_per_ip burst=30 delay=15; + limit_conn conn_limit_per_ip 30; try_files $uri =404; @@ -145,9 +145,9 @@ server { fastcgi_temp_file_write_size 256k; # Таймауты - fastcgi_connect_timeout 10s; - fastcgi_send_timeout 30s; - fastcgi_read_timeout 30s; + fastcgi_connect_timeout 60s; + fastcgi_send_timeout 600s; + fastcgi_read_timeout 600s; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; @@ -157,12 +157,8 @@ server { # ========== ОСНОВНОЙ 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; } diff --git a/docker/nginx.conf b/docker/nginx.conf index 2190329..f9a1903 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -40,7 +40,7 @@ http { sendfile on; tcp_nopush on; tcp_nodelay on; - keepalive_timeout 65; + keepalive_timeout 75; keepalive_requests 100; types_hash_max_size 2048; server_tokens off; @@ -49,7 +49,7 @@ http { client_body_timeout 12; client_header_timeout 12; - send_timeout 10; + send_timeout 30; reset_timedout_connection on; client_header_buffer_size 1k; diff --git a/resources/js/Composables/useMedicalHistoryFilter.js b/resources/js/Composables/useMedicalHistoryFilter.js index a4387d5..c788da7 100644 --- a/resources/js/Composables/useMedicalHistoryFilter.js +++ b/resources/js/Composables/useMedicalHistoryFilter.js @@ -124,6 +124,11 @@ export const useMedicalHistoryFilter = (initialFilters = {}) => { 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) => { dateRange.value = timestamps || [null, null] @@ -238,9 +243,6 @@ export const useMedicalHistoryFilter = (initialFilters = {}) => { updates.date_extract_to = null dateRange.value = [null, null] break - case 'database': - updates.database = 'postgresql' - break } Object.assign(filtersRef.value, updates) @@ -277,6 +279,7 @@ export const useMedicalHistoryFilter = (initialFilters = {}) => { activeFilters, dateRange, searchValue, + statusValue, // Обработчики handleSearch, diff --git a/resources/js/Composables/useNotification.js b/resources/js/Composables/useNotification.js index cc50c6c..1c69032 100644 --- a/resources/js/Composables/useNotification.js +++ b/resources/js/Composables/useNotification.js @@ -14,13 +14,15 @@ export function useNotification() { } - const errorApi = (data, content = '', options = {}) => { + const errorApi = (data, content = null, options = {}) => { return showNotification( { 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: () => { - return h( + return content ? content : h( NLog, { rows: 4, diff --git a/resources/js/Pages/Home/ArchiveHistoryCreateModal/Index.vue b/resources/js/Pages/Home/ArchiveHistoryCreateModal/Index.vue index e8b308b..9755752 100644 --- a/resources/js/Pages/Home/ArchiveHistoryCreateModal/Index.vue +++ b/resources/js/Pages/Home/ArchiveHistoryCreateModal/Index.vue @@ -15,7 +15,40 @@ const archiveInfo = ref({ num: 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 formRef = ref(null) const emits = defineEmits(['historyUpdated', 'closeWithoutSave']) @@ -30,6 +63,7 @@ const onResetData = () => { const onCloseWithoutSave = () => { emits('closeWithoutSave') open.value = false + onResetData() } const filteredPatients = ref([]) @@ -49,51 +83,79 @@ const handleSearchCard = (query) => { debounceSearchCard(query) } -const onSubmit = async () => { - loading.value = true - try { - await axios.post(`/api/archive/create`, archiveInfo.value).then(res => { - open.value = false - }) +const onSubmit = async (e) => { + e.preventDefault() + formRef.value?.validate(async (errors) => { + if (!errors) { + loading.value = true + try { + await axios.post(`/api/archive/create`, archiveInfo.value).then(res => { + open.value = false + }) - } catch (error) { - errorApi(error) - console.error(error) - } finally { - loading.value = false - } + } catch (error) { + errorApi(error) + console.error(error) + } finally { + loading.value = false + } + } + else { + console.log(errors) + errorApi(null, 'Проверьте заполненность формы') + } + }) }