diff --git a/app/Admin/Controllers/PatientRecordController.php b/app/Admin/Controllers/PatientRecordController.php index c727d9a..e57f2bf 100644 --- a/app/Admin/Controllers/PatientRecordController.php +++ b/app/Admin/Controllers/PatientRecordController.php @@ -70,7 +70,7 @@ class PatientRecordController extends AdminController ['type' => 'text', 'text' => __('patient-record.doctor_money').': ${doctor_money}', 'colSpan' => 2], ['type' => 'text', 'text' => __('patient-record.inviter_money').': ${inviter_money}', 'colSpan' => 2], ['type' => 'text', 'text' => __('patient-record.saler_money').': ${saler_money}', 'colSpan' => 2], - ['type' => 'text', 'text' => ''], + ['type' => 'text', 'text' => __('patient-record.total_money').': ${total_money}'], ]); return $this->baseList($crud); diff --git a/app/Admin/Services/PatientRecordService.php b/app/Admin/Services/PatientRecordService.php index 1d00f7b..8adb5d0 100644 --- a/app/Admin/Services/PatientRecordService.php +++ b/app/Admin/Services/PatientRecordService.php @@ -41,12 +41,14 @@ class PatientRecordService extends BaseService $list = $query->clone()->paginate(request()->input('perPage', 20)); $items = $list->items(); $total = $list->total(); + $sell_price = round($query->clone()->sum('sell_price'), 2, PHP_ROUND_HALF_DOWN); $doctor_money = round($query->clone()->sum('doctor_money'), 2, PHP_ROUND_HALF_DOWN); $inviter_money = round($query->clone()->sum('inviter_money'), 2, PHP_ROUND_HALF_DOWN); $saler_money = round($query->clone()->sum('saler_money'), 2, PHP_ROUND_HALF_DOWN); + $total_money = round($doctor_money + $inviter_money + $saler_money, 2, PHP_ROUND_HALF_DOWN); - return compact('items', 'total', 'sell_price', 'doctor_money', 'inviter_money', 'saler_money'); + return compact('items', 'total', 'sell_price', 'doctor_money', 'inviter_money', 'saler_money', 'total_money'); } public function resloveData($data, $model = null) diff --git a/database/migrations/2023_08_30_090313_create_patient_records_table.php b/database/migrations/2023_08_30_090313_create_patient_records_table.php index f7f3416..217bc76 100644 --- a/database/migrations/2023_08_30_090313_create_patient_records_table.php +++ b/database/migrations/2023_08_30_090313_create_patient_records_table.php @@ -17,7 +17,7 @@ return new class extends Migration $table->unsignedBigInteger('type_id')->comment('类别, keywords.id'); $table->unsignedBigInteger('illness_type_id')->comment('病种, keywords.id'); $table->timestamp('treat_at')->comment('就诊时间'); - $table->text('content')->comment('就诊情况'); + $table->text('content')->nullable()->comment('就诊情况'); $table->json('images')->nullable()->comment('图片'); $table->decimal('origin_price')->default(0)->comment('划线价'); $table->decimal('sell_price')->default(0)->comment('实收价'); diff --git a/lang/zh_CN/patient-record.php b/lang/zh_CN/patient-record.php index d8f9e6d..045e09a 100644 --- a/lang/zh_CN/patient-record.php +++ b/lang/zh_CN/patient-record.php @@ -28,4 +28,5 @@ return [ 'created_at' => '录入时间', 'images' => '图片资料', 'illness_type_id' => '病种', + 'total_money' => '总提成', ];