Перевел добавление пациентов для мед. сестры из МИС
This commit is contained in:
@@ -9,33 +9,47 @@ use App\Models\MedicalHistoryNurse;
|
||||
use App\Models\MigrationPatient;
|
||||
use App\Models\MigrationPatientCorrection;
|
||||
use App\Models\MigrationPatientNurse;
|
||||
use App\Models\MisMKSB;
|
||||
use App\Models\MisStationarBranch;
|
||||
use App\Models\ReportNurse;
|
||||
use App\Models\ReportNurseMigrationPatient;
|
||||
use App\Models\ReportNursePatient;
|
||||
use App\Models\UnifiedMedicalHistory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class NurseController extends Controller
|
||||
{
|
||||
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)
|
||||
{
|
||||
$search = $request->search;
|
||||
|
||||
return MedicalHistory::whereLike('full_name', $search . '%')
|
||||
->orderBy('recipient_date', 'desc')
|
||||
->get()->map(function ($item) {
|
||||
return [
|
||||
'label' => "$item->medical_card_number - $item->full_name",
|
||||
'value' => $item->id
|
||||
];
|
||||
});
|
||||
$results = Cache::remember('patients_search_' . $search, 120, function () use ($search) {
|
||||
return MisMKSB::select([
|
||||
'MedicalHistoryID as original_id', 'MedCardNum as medical_card_number', DB::raw('(FAMILY + \' \' + Name + \' \' + OT) as full_name'),
|
||||
])
|
||||
->findByFIO($search)
|
||||
->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)
|
||||
|
||||
Reference in New Issue
Block a user