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

* добавил автоматическое создание движения при редактировании
* добавил функционал для сохранения отчета и пациентов
* изменил форматирование дат
* добавил частичную перезагрузку при сохранении изменений
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);
}
}
}