feat: 第二阶段核心业务模块(CRM/房务/护理/月子餐)
后端: - 4个迁移文件新增23张业务表 - 23个Eloquent Model(含关联/类型转换/门店隔离) - 20个Controller(含CRUD+业务操作: 合同审核/入住退房/护理异常处理等) - 110+条API路由(crm/room/care/meal四大前缀) 前端: - 4个API模块(crm.js/room.js/care.js/meal.js) - 13个业务页面(线索/客户/合同/渠道/投诉/房型/房间/预定/护理档案/护理计划/护理记录/菜品/排餐)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Care;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class CareException extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'care_profile_id', 'reporter_id', 'level', 'description',
|
||||
'images', 'status', 'handler_id', 'handle_result', 'handle_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'level' => 'integer',
|
||||
'images' => 'array',
|
||||
'status' => 'integer',
|
||||
'handle_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function profile(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CareProfile::class, 'care_profile_id');
|
||||
}
|
||||
|
||||
public function reporter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'reporter_id');
|
||||
}
|
||||
|
||||
public function handler(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'handler_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Care;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class CarePlan extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'care_profile_id', 'plan_date', 'stage', 'items',
|
||||
'nurse_id', 'status',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'plan_date' => 'date',
|
||||
'items' => 'array',
|
||||
'status' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function profile(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CareProfile::class, 'care_profile_id');
|
||||
}
|
||||
|
||||
public function nurse(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'nurse_id');
|
||||
}
|
||||
|
||||
public function records(): HasMany
|
||||
{
|
||||
return $this->hasMany(CareRecord::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Care;
|
||||
|
||||
use App\Models\Crm\Customer;
|
||||
use App\Models\Room\Reservation;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class CareProfile extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'customer_id', 'reservation_id', 'type', 'baby_name', 'baby_gender',
|
||||
'baby_birthday', 'birth_weight', 'birth_method',
|
||||
'allergies', 'medical_history', 'risk_level', 'assessment',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'type' => 'integer',
|
||||
'baby_gender' => 'integer',
|
||||
'baby_birthday' => 'datetime',
|
||||
'birth_weight' => 'decimal:2',
|
||||
'birth_method' => 'integer',
|
||||
'risk_level' => 'integer',
|
||||
'assessment' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function reservation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Reservation::class);
|
||||
}
|
||||
|
||||
public function plans(): HasMany
|
||||
{
|
||||
return $this->hasMany(CarePlan::class);
|
||||
}
|
||||
|
||||
public function records(): HasMany
|
||||
{
|
||||
return $this->hasMany(CareRecord::class);
|
||||
}
|
||||
|
||||
public function exceptions(): HasMany
|
||||
{
|
||||
return $this->hasMany(CareException::class);
|
||||
}
|
||||
|
||||
public function healthMetrics(): HasMany
|
||||
{
|
||||
return $this->hasMany(HealthMetric::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Care;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class CareRecord extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'care_profile_id', 'care_plan_id', 'type',
|
||||
'items', 'remark', 'images', 'nurse_id', 'recorded_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'type' => 'integer',
|
||||
'items' => 'array',
|
||||
'images' => 'array',
|
||||
'recorded_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function profile(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CareProfile::class, 'care_profile_id');
|
||||
}
|
||||
|
||||
public function plan(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CarePlan::class, 'care_plan_id');
|
||||
}
|
||||
|
||||
public function nurse(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'nurse_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Care;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class HealthMetric extends Model
|
||||
{
|
||||
const UPDATED_AT = null;
|
||||
|
||||
protected $fillable = [
|
||||
'care_profile_id', 'metric_type', 'value', 'unit',
|
||||
'recorded_at', 'recorder_id', 'remark',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'value' => 'decimal:2',
|
||||
'recorded_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function profile(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CareProfile::class, 'care_profile_id');
|
||||
}
|
||||
|
||||
public function recorder(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'recorder_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user