* добавил объединение изменений движений

* добавил автоматическое создание движения при редактировании
* добавил функционал для сохранения отчета и пациентов
* изменил форматирование дат
* добавил частичную перезагрузку при сохранении изменений
This commit is contained in:
brusnitsyn
2026-05-05 17:06:15 +09:00
parent 51a4b5b9de
commit 717641e4bb
18 changed files with 712 additions and 60 deletions

View File

@@ -6,8 +6,11 @@ use App\Http\Controllers\Controller;
use App\Models\MedicalHistory;
use App\Models\MedicalHistoryCorrection;
use App\Models\MedicalHistoryNurse;
use App\Models\MigrationPatient;
use App\Models\MigrationPatientCorrection;
use App\Models\UnifiedMedicalHistory;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class NurseController extends Controller
{
@@ -77,10 +80,33 @@ class NurseController extends Controller
$data['medical_history_id'] = $id;
$data['user_id'] = auth()->user()->id;
$result = MedicalHistoryCorrection::create($data);
$currentMigration = MigrationPatient::currentMigration($id);
return response()->json([
'data' => $result,
], 201);
$migrationData = [
'migration_patient_id' => $currentMigration->id,
'medical_history_id' => $id,
'ingoing_date' => $data['recipient_date'],
'out_date' => $data['extract_date'],
'visit_result_id' => $data['visit_result_id'],
'user_id' => $data['user_id'],
];
DB::beginTransaction();
$historyCorrection = MedicalHistoryCorrection::create($data);
$migrationCorrection = MigrationPatientCorrection::create($migrationData);
if ($historyCorrection && $migrationCorrection) {
DB::commit();
return response()->json([
'data' => $historyCorrection,
], 201);
} else {
DB::rollBack();
return response()->json([
'data' => 'Something went wrong',
], 400);
}
}
}

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Models\Department;
use App\Services\DateRangeService;
use App\Services\NurseReportService;
use App\Services\UnifiedMedicalHistoryService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@@ -14,7 +15,8 @@ class NurseReportController extends Controller
{
public function __construct(
protected DateRangeService $dateRangeService,
protected UnifiedMedicalHistoryService $unifiedMedicalHistoryService
protected UnifiedMedicalHistoryService $unifiedMedicalHistoryService,
protected NurseReportService $nurseReportService,
)
{}
@@ -51,10 +53,16 @@ class NurseReportController extends Controller
/**
* Сохранение отчета от роли мед. сестра
* @return void
* @return \Illuminate\Http\RedirectResponse
*/
public function store()
public function store(Request $request)
{
$user = auth()->user();
$dateRange = $this->dateRangeService->getDateRangeFromRequest($request, $user);
$report = $this->nurseReportService->saveReport($dateRange);
$this->nurseReportService->saveSnapshot($dateRange, $report);
return redirect()->back();
}
}