* связка таблицы архива с пациентами
* добавил разграничение карт по типам баз * модель для хранения изменений статуса карт * добавил окно с просмотром выдачи карты * добавил фильтрацию вывода карт
This commit is contained in:
@@ -13,17 +13,30 @@ class IndexController extends Controller
|
||||
{
|
||||
$pageSize = $request->get('page_size', 15);
|
||||
$searchText = $request->get('search', null);
|
||||
$dateExtractFrom = $request->get('date_extract_from', null);
|
||||
$dateExtractTo = $request->get('date_extract_to', null);
|
||||
$viewType = $request->get('view_type', 'archive');
|
||||
|
||||
$cards = SttMedicalHistory::query();
|
||||
$cardsQuery = SttMedicalHistory::query();
|
||||
|
||||
if (!empty($searchText)) {
|
||||
$cards = $cards->search($searchText);
|
||||
$cardsQuery = $cardsQuery->search($searchText);
|
||||
}
|
||||
|
||||
$cards = SttMedicalHistoryResource::collection($cards->paginate($pageSize));
|
||||
if (!empty($dateExtractFrom)) {
|
||||
$cardsQuery = $cardsQuery->whereDate('dateextract', '>=', $dateExtractFrom);
|
||||
if (!empty($dateExtractTo)) {
|
||||
$cardsQuery = $cardsQuery->whereDate('dateextract', '<=', $dateExtractTo);
|
||||
}
|
||||
}
|
||||
|
||||
$cards = SttMedicalHistoryResource::collection($cardsQuery->paginate($pageSize));
|
||||
|
||||
return Inertia::render('Home/Index', [
|
||||
'cards' => $cards,
|
||||
'filters' => $request->only([
|
||||
'search', 'date_extract_from', 'date_extract_to', 'page_size', 'page', 'view_type'
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
28
app/Http/Controllers/MedicalHistoryController.php
Normal file
28
app/Http/Controllers/MedicalHistoryController.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\SI\SttMedicalHistory;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MedicalHistoryController extends Controller
|
||||
{
|
||||
public function patient($id, Request $request)
|
||||
{
|
||||
$viewType = $request->get('view_type', 'si');
|
||||
$patientId = $request->get('patient_id');
|
||||
|
||||
$patientInfo = null;
|
||||
if ($viewType == 'si') {
|
||||
$patient = SttMedicalHistory::where('id', $id)->first();
|
||||
$archiveJournal = $patient->archiveHistory;
|
||||
|
||||
$patientInfo = [
|
||||
'info' => $patient,
|
||||
'journal' => $archiveJournal,
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($patientInfo);
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,15 @@ class SttMedicalHistoryResource extends JsonResource
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'fullname' => $this->getFullNameAttribute(),
|
||||
'mpostdate' => Carbon::parse($this->mpostdate)->format('d.m.Y'),
|
||||
'menddate' => Carbon::parse($this->menddate)->format('d.m.Y'),
|
||||
'daterecipient' => Carbon::parse($this->daterecipient)->format('d.m.Y'),
|
||||
'dateextract' => Carbon::parse($this->dateextract)->format('d.m.Y'),
|
||||
'narhiv' => $this->narhiv,
|
||||
'datearhiv' => Carbon::parse($this->datearhiv)->format('d.m.Y'),
|
||||
'statgod' => $this->statgod,
|
||||
'enp' => $this->enp,
|
||||
'nkarta' => $this->nkarta,
|
||||
'medcardnum' => $this->medcardnum,
|
||||
'dr' => Carbon::parse($this->dr)->format('d.m.Y'),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user