Перевел добавление пациентов для мед. сестры из МИС
This commit is contained in:
@@ -9,33 +9,47 @@ use App\Models\MedicalHistoryNurse;
|
|||||||
use App\Models\MigrationPatient;
|
use App\Models\MigrationPatient;
|
||||||
use App\Models\MigrationPatientCorrection;
|
use App\Models\MigrationPatientCorrection;
|
||||||
use App\Models\MigrationPatientNurse;
|
use App\Models\MigrationPatientNurse;
|
||||||
|
use App\Models\MisMKSB;
|
||||||
use App\Models\MisStationarBranch;
|
use App\Models\MisStationarBranch;
|
||||||
use App\Models\ReportNurse;
|
use App\Models\ReportNurse;
|
||||||
use App\Models\ReportNurseMigrationPatient;
|
use App\Models\ReportNurseMigrationPatient;
|
||||||
use App\Models\ReportNursePatient;
|
use App\Models\ReportNursePatient;
|
||||||
use App\Models\UnifiedMedicalHistory;
|
use App\Models\UnifiedMedicalHistory;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class NurseController extends Controller
|
class NurseController extends Controller
|
||||||
{
|
{
|
||||||
public function getPatient($id, Request $request)
|
public function getPatient($id, Request $request)
|
||||||
{
|
{
|
||||||
return UnifiedMedicalHistory::where('id', $id)->first();
|
return Cache::remember("nurse_patient:{$id}", 120, function () use ($id, $request) {
|
||||||
|
return MisMKSB::where('MedicalHistoryID', $id)->select(MisMKSB::workColumns())->first();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function searchPatients(Request $request)
|
public function searchPatients(Request $request)
|
||||||
{
|
{
|
||||||
$search = $request->search;
|
$search = $request->search;
|
||||||
|
|
||||||
return MedicalHistory::whereLike('full_name', $search . '%')
|
$results = Cache::remember('patients_search_' . $search, 120, function () use ($search) {
|
||||||
->orderBy('recipient_date', 'desc')
|
return MisMKSB::select([
|
||||||
->get()->map(function ($item) {
|
'MedicalHistoryID as original_id', 'MedCardNum as medical_card_number', DB::raw('(FAMILY + \' \' + Name + \' \' + OT) as full_name'),
|
||||||
return [
|
])
|
||||||
'label' => "$item->medical_card_number - $item->full_name",
|
->findByFIO($search)
|
||||||
'value' => $item->id
|
->limit(10)
|
||||||
];
|
->orderBy('DateExtract', 'desc')
|
||||||
});
|
->get()->map(function ($item) {
|
||||||
|
$fullName = Str::title($item->full_name);
|
||||||
|
return [
|
||||||
|
'label' => "$item->medical_card_number - $fullName",
|
||||||
|
'value' => $item->original_id
|
||||||
|
];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function storePatient(Request $request)
|
public function storePatient(Request $request)
|
||||||
|
|||||||
42
app/Models/MisMKSB.php
Normal file
42
app/Models/MisMKSB.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Стационарная карта больного
|
||||||
|
*/
|
||||||
|
class MisMKSB extends MaterializedViewModel
|
||||||
|
{
|
||||||
|
protected $connection = 'mis';
|
||||||
|
protected $table = 'stt_MedicalHistory';
|
||||||
|
protected $primaryKey = 'MedicalHistoryID';
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'original_id' => 'int',
|
||||||
|
'birth_date' => 'date:Y-m-d',
|
||||||
|
'recipient_date' => 'datetime:Y-m-d H:i:s',
|
||||||
|
'extract_date' => 'datetime:Y-m-d H:i:s',
|
||||||
|
'death_date' => 'datetime:Y-m-d H:i:s',
|
||||||
|
'male' => 'boolean',
|
||||||
|
'urgency_id' => 'int',
|
||||||
|
'hospital_result_id' => 'int',
|
||||||
|
'visit_result_id' => 'int',
|
||||||
|
];
|
||||||
|
|
||||||
|
public static function workColumns() {
|
||||||
|
return [
|
||||||
|
'MedicalHistoryID as original_id', 'MedCardNum as medical_card_number',
|
||||||
|
DB::raw('(FAMILY + \' \' + Name + \' \' + OT) as full_name'), 'BD as birth_date',
|
||||||
|
'DateRecipient as recipient_date', 'DateExtract as extract_date', 'DateDeath as death_date', 'Sex as male',
|
||||||
|
'rf_EmerSignID as urgency_id', 'rf_kl_StatCureResultID as hospital_result_id', 'rf_kl_VisitResultID as visit_result_id'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeFindByFIO($query, $search)
|
||||||
|
{
|
||||||
|
$query->where(DB::raw('(FAMILY + \' \' + Name + \' \' + OT)'), 'like', "$search%");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import AppRadio from "../../../Components/AppRadio.vue";
|
|||||||
import {useDebounceFn} from "@vueuse/core";
|
import {useDebounceFn} from "@vueuse/core";
|
||||||
import {format} from "date-fns";
|
import {format} from "date-fns";
|
||||||
import {router} from "@inertiajs/vue3";
|
import {router} from "@inertiajs/vue3";
|
||||||
|
import AppPanel from "../../../Components/AppPanel.vue"
|
||||||
const show = defineModel('show', { default: false })
|
const show = defineModel('show', { default: false })
|
||||||
|
|
||||||
const currentStep = ref(1)
|
const currentStep = ref(1)
|
||||||
@@ -69,7 +70,7 @@ const visitResultOptions = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '3 - Переведён в дневной стационар',
|
label: '3 - Переведён в дневной стационар',
|
||||||
value: 2
|
value: 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '4 - Переведён на другой профиль коек',
|
label: '4 - Переведён на другой профиль коек',
|
||||||
@@ -139,9 +140,15 @@ const submit = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const searchOptions = ref([])
|
const searchOptions = ref([])
|
||||||
|
const loadingSelect = ref(false)
|
||||||
|
const loadingChangeSelect = ref(false)
|
||||||
|
|
||||||
const debounceSearch = useDebounceFn((s) => {
|
const debounceSearch = useDebounceFn((s) => {
|
||||||
if (s.length === 0 || s.length === 1) return
|
if (s.length === 0 || s.length === 1) {
|
||||||
|
searchOptions.value = []
|
||||||
|
loadingSelect.value = false
|
||||||
|
}
|
||||||
|
loadingSelect.value = true
|
||||||
search(s)
|
search(s)
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
@@ -150,10 +157,13 @@ const search = (search) => {
|
|||||||
search
|
search
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
searchOptions.value = res.data
|
searchOptions.value = res.data
|
||||||
|
}).finally((e) => {
|
||||||
|
loadingSelect.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeSearch = (historyId) => {
|
const onChangeSearch = (historyId) => {
|
||||||
|
loadingChangeSelect.value = true
|
||||||
axios.get(`/api/nurse/patients/${historyId}`).then(res => {
|
axios.get(`/api/nurse/patients/${historyId}`).then(res => {
|
||||||
form.value.medical_card_number = res.data.medical_card_number
|
form.value.medical_card_number = res.data.medical_card_number
|
||||||
form.value.full_name = res.data.full_name
|
form.value.full_name = res.data.full_name
|
||||||
@@ -164,12 +174,20 @@ const onChangeSearch = (historyId) => {
|
|||||||
form.value.death_date = res.data.death_date
|
form.value.death_date = res.data.death_date
|
||||||
form.value.extract_date = res.data.extract_date
|
form.value.extract_date = res.data.extract_date
|
||||||
form.value.recipient_date = res.data.recipient_date
|
form.value.recipient_date = res.data.recipient_date
|
||||||
|
}).finally((e) => {
|
||||||
|
loadingChangeSelect.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => currentStep.value, (val) => {
|
watch(() => currentStep.value, (val) => {
|
||||||
if (val === 1) resetForm()
|
if (val === 1) resetForm()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const onAfterLeave = () => {
|
||||||
|
resetForm()
|
||||||
|
currentStep.value = 1
|
||||||
|
searchOptions.value = []
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -181,6 +199,7 @@ watch(() => currentStep.value, (val) => {
|
|||||||
draggable
|
draggable
|
||||||
:close-on-esc="!buttonLoading"
|
:close-on-esc="!buttonLoading"
|
||||||
:closable="!buttonLoading"
|
:closable="!buttonLoading"
|
||||||
|
@afterLeave="onAfterLeave"
|
||||||
>
|
>
|
||||||
<NSteps size="small" :current="currentStep" :status="currentStatus">
|
<NSteps size="small" :current="currentStep" :status="currentStatus">
|
||||||
<NStep title="Тип пациента" description="Укажите тип пациента" />
|
<NStep title="Тип пациента" description="Укажите тип пациента" />
|
||||||
@@ -194,43 +213,46 @@ watch(() => currentStep.value, (val) => {
|
|||||||
</NRadioGroup>
|
</NRadioGroup>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<NTabPane :name="2">
|
<NTabPane :name="2">
|
||||||
<NGrid cols="2" x-gap="8">
|
<AppPanel :loading="loadingChangeSelect" class="border-none!" no-padding>
|
||||||
<NFormItemGi v-if="form.patient_source === 'mis'" span="2" label="Поиск пациента">
|
<NGrid cols="2" x-gap="8">
|
||||||
<NSelect v-model:value="form.id"
|
<NFormItemGi v-if="form.patient_source === 'mis'" span="2" label="Поиск пациента">
|
||||||
filterable
|
<NSelect v-model:value="form.id"
|
||||||
placeholder="Найти пациента по ФИО"
|
filterable
|
||||||
remote
|
placeholder="Найти пациента по ФИО"
|
||||||
:options="searchOptions"
|
remote
|
||||||
@search="debounceSearch"
|
:loading="loadingSelect"
|
||||||
@change="onChangeSearch"
|
:options="searchOptions"
|
||||||
/>
|
@search="debounceSearch"
|
||||||
</NFormItemGi>
|
@change="onChangeSearch"
|
||||||
<NFormItemGi span="2" label="ФИО">
|
/>
|
||||||
<NInput v-model:value="form.full_name" placeholder="Иванов Иван Иванович" />
|
</NFormItemGi>
|
||||||
</NFormItemGi>
|
<NFormItemGi span="2" label="ФИО">
|
||||||
<NFormItemGi span="2" label="№ карты">
|
<NInput v-model:value="form.full_name" placeholder="Иванов Иван Иванович" />
|
||||||
<NInput v-model:value="form.medical_card_number" />
|
</NFormItemGi>
|
||||||
</NFormItemGi>
|
<NFormItemGi span="2" label="№ карты">
|
||||||
|
<NInput v-model:value="form.medical_card_number" />
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
<NFormItemGi span="1" label="Срочность">
|
<NFormItemGi span="1" label="Срочность">
|
||||||
<NSelect filterable v-model:value="form.urgency_id" :options="urgencyOptions" />
|
<NSelect filterable v-model:value="form.urgency_id" :options="urgencyOptions" />
|
||||||
</NFormItemGi>
|
</NFormItemGi>
|
||||||
<NFormItemGi span="1" label="Исход госпитализации">
|
<NFormItemGi span="1" label="Исход госпитализации">
|
||||||
<NSelect filterable v-model:value="form.visit_result_id" :options="visitResultOptions" />
|
<NSelect filterable v-model:value="form.visit_result_id" :options="visitResultOptions" />
|
||||||
</NFormItemGi>
|
</NFormItemGi>
|
||||||
<NFormItemGi span="1" label="Дата рождения">
|
<NFormItemGi span="1" label="Дата рождения">
|
||||||
<NDatePicker v-model:formatted-value="form.birth_date" class="w-full" format="dd.MM.yyyy" value-format="yyyy-MM-dd" clearable />
|
<NDatePicker v-model:formatted-value="form.birth_date" class="w-full" format="dd.MM.yyyy" value-format="yyyy-MM-dd" clearable />
|
||||||
</NFormItemGi>
|
</NFormItemGi>
|
||||||
<NFormItemGi span="1" label="Дата и время госпитализации">
|
<NFormItemGi span="1" label="Дата и время госпитализации">
|
||||||
<NDatePicker v-model:formatted-value="form.recipient_date" type="datetime" class="w-full" format="dd.MM.yyyy HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" clearable />
|
<NDatePicker v-model:formatted-value="form.recipient_date" type="datetime" class="w-full" format="dd.MM.yyyy HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" clearable />
|
||||||
</NFormItemGi>
|
</NFormItemGi>
|
||||||
<NFormItemGi span="1" label="Дата и время выписки">
|
<NFormItemGi span="1" label="Дата и время выписки">
|
||||||
<NDatePicker v-model:formatted-value="form.extract_date" type="datetime" class="w-full" format="dd.MM.yyyy HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" clearable />
|
<NDatePicker v-model:formatted-value="form.extract_date" type="datetime" class="w-full" format="dd.MM.yyyy HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" clearable />
|
||||||
</NFormItemGi>
|
</NFormItemGi>
|
||||||
<NFormItemGi span="1" label="Дата и время смерти">
|
<NFormItemGi span="1" label="Дата и время смерти">
|
||||||
<NDatePicker v-model:formatted-value="form.death_date" type="datetime" class="w-full" format="dd.MM.yyyy HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" clearable />
|
<NDatePicker v-model:formatted-value="form.death_date" type="datetime" class="w-full" format="dd.MM.yyyy HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" clearable />
|
||||||
</NFormItemGi>
|
</NFormItemGi>
|
||||||
</NGrid>
|
</NGrid>
|
||||||
|
</AppPanel>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
</NTabs>
|
</NTabs>
|
||||||
<template #action>
|
<template #action>
|
||||||
|
|||||||
Reference in New Issue
Block a user