Обновление отчета
This commit is contained in:
@@ -136,9 +136,20 @@ class ReportController extends Controller
|
||||
->map(function ($item, $index) {
|
||||
$item->num = $index + 1;
|
||||
return $item;
|
||||
});;
|
||||
});
|
||||
} else if ($status === 'observation') {
|
||||
$patients = ObservationPatient::with(['history'])
|
||||
->where('rf_department_id', $misDepartmentId)
|
||||
->history;
|
||||
} else if ($status === 'deceased') {
|
||||
|
||||
$patients = MisMedicalHistory::select(...$model->getFillable())
|
||||
->deceased()
|
||||
->inDepartment($misDepartmentId, $startDate, $endDate)
|
||||
->get()
|
||||
->map(function ($item, $index) {
|
||||
$item->num = $index + 1;
|
||||
return $item;
|
||||
});
|
||||
}
|
||||
|
||||
$patients->load(['migrations' => function ($query) use ($startDate, $endDate, $misStationarBranchId) {
|
||||
|
||||
@@ -26,7 +26,8 @@ class StatisticController extends Controller
|
||||
|
||||
$data = [];
|
||||
|
||||
$departments = Department::select('department_id', 'name_short')->get();
|
||||
$departments = Department::select('department_id', 'name_short')
|
||||
->orderBy('name_short')->get();
|
||||
|
||||
foreach ($departments as $department) {
|
||||
$allCount = MetrikaResult::whereHas('report', function ($query) use ($userDepartment, $department) {
|
||||
|
||||
@@ -21,8 +21,8 @@ class FormattedPatientResource extends JsonResource
|
||||
'num' => $this->num,
|
||||
'mkb' => $this->whenLoaded('migrations', function () {
|
||||
return [
|
||||
'ds' => $this->migrations()->first()->diagnosis()->first()->mkb()->first()->DS ?? null,
|
||||
'name' => $this->migrations()->first()->diagnosis()->first()->mkb()->first()->NAME ?? null,
|
||||
'ds' => $this->migrations()->first()->diagnosis()->first()?->mkb()->first()->DS ?? null,
|
||||
'name' => $this->migrations()->first()->diagnosis()->first()?->mkb()->first()->NAME ?? null,
|
||||
];
|
||||
}),
|
||||
'fullname' => Str::ucwords(Str::lower("$this->FAMILY $this->Name $this->OT")),
|
||||
|
||||
@@ -40,6 +40,14 @@ class MisMedicalHistory extends Model
|
||||
return $this->where('rf_EmerSignID', 2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Истории с результатом - Умер
|
||||
*/
|
||||
public function scopeDeceased()
|
||||
{
|
||||
return $this->where('rf_kl_VisitResultID', 5);
|
||||
}
|
||||
|
||||
/*
|
||||
* Движения истории
|
||||
*/
|
||||
|
||||
@@ -15,4 +15,9 @@ class ObservationPatient extends Model
|
||||
'rf_department_id',
|
||||
'rf_report_id',
|
||||
];
|
||||
|
||||
public function history()
|
||||
{
|
||||
return $this->belongsTo(MisMedicalHistory::class, 'rf_medicalhistory_id', 'MedicalHistoryID');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user